import {createRouter, createWebHistory} from 'vue-router'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'login',
      component: () => import('../views/Login.vue'),
    },
    {
      path: '/register',
      name: 'register',
      component: () => import('../views/Register.vue'),
    },
    {
      path: '/home',
      name: 'home',
      component: () => import('../views/Home.vue'),
      children:[
        { path: 'drug', name: 'drug', component: () => import('../views/Drug.vue') },
        { path: 'person', name: 'person', component: () => import('../views/Person.vue') },
        { path: 'drugDetails', name: 'drugDetails', component: () => import('../views/DrugDetails.vue') },
        { path: 'updatePassword', name: 'updatePassword', component: () => import('../views/UpdatePassword.vue') },
        { path: 'order', name: 'order', component: () => import('../views/Orders.vue') }
      ],
      redirect: '/home/drug'
    }
  ],
})

export default router
